import Vue from 'vue'
import Router from 'vue-router'

import login from '@/views/Login'
import register from '@/views/register'
import index from '@/views/index/index'
import userIndex from '@/views/userIndex/userIndex'
import about from '@/views/about/index'
import listNews from '@/views/listNews/index'
import listVideo from '@/views/listVideo/index'
import listWorks from '@/views/listWorks/index'
import showWorks from '@/views/showWorks/index'
import guide from '@/views/guide/index'


Vue.use(Router);



export default new Router({
    routes: [
        {
            path:'/',  //主页
            name: 'index',
            component: index,
            meta: { title:"华中版权交易平台"}
        },
        {
            path: '/login', // 登录页
            name: 'login',
            component: login,
            meta: { title:"登录"}
        },
        {
            path:'/register', //注册
            name:'register',
            component: register,
            meta: { title:"注册"}
        },
        {
            //个人挂牌信息页
            path: '/userIndex',
            name: 'userIndex',
            component: userIndex,
            redirect: "/userIndex/myTrading", //重定向到子路由，设置我的挂牌为默认显示
            meta: { title:"个人主页"},
            children:[
                {
                    path:'addTrading', //新增挂牌
                    name:'addTrading',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/addTrading')
                },
                {
                    path:'myTrading',//我的挂牌
                    name:'myTrading',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/myTrading')

                },
                {
                    path:'myDelist',//我的摘牌
                    name:'myDelist',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/myDelist')
                },
                {
                    path:'myContract',//我的合同
                    name:'myContract',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/myContract')
                },
                {
                    path:'myCollection',//我的收藏
                    name:'myCollection',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/myCollection')
                },
                {
                    path:'myInvoice',//我的发票
                    name:'myInvoice',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/myInvoice')
                },
                {
                    path:'myNews',//我的消息
                    name:'myNews',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/myNews')
                },
                {
                    path:'userInfoEdit', //账户设置
                    name:'userInfoEdit',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/userInfoEdit')
                },
                {
                    path:'delistApply',//摘牌申请
                    name:'delistApply',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/delistApply')
                }
            ]
        },
        {
            path: '/about', //关于我们
            name: 'about',
            component: about,
        },
        {
            path:'/listNews', //行业资讯
            name:'listNews',
            component: listNews
        },
        {
            path:'/listVideo', //影视版权
            name:'listVideo',
            component: listVideo
        },
        {
            path:'/listWorks',//版权交易
            name:'listWorks',
            component: listWorks
        },
        {
            path:'/showWorks', //产品详情页
            name:'showWorks',
            component: showWorks
        },
        {
            path:'/guide', //交易指引
            name:'guide',
            component:guide
        }

    ]
});
